const path = require('path');
const webpack = require('webpack'); //to access built-in plugins
const VueLoaderPlugin=require('vue-loader/lib/plugin')
// const HtmlWebpackPlugin = require('html-webpack-plugin');
module.exports = {
    devtool: 'eval-source-map',
    // devtool: 'source-map',
    // devtool: '',
    mode: 'production',
    entry: './src/main.js',
    output: {
        filename: 'bundle.js',
        path: path.resolve(__dirname, 'dist'),
    },
    resolve:{
        alias:{
            'vue$': 'vue/dist/vue.esm.js'
        }
    },
    module:{
        rules:[
            {
                test: /\.m?js$/,
                exclude: /(node_modules\/(?!bootstrap-vue\/src\/)|node_modules|bower_components)/,
                use: {
                    loader: 'babel-loader',
                    options: {
                        presets: [
                            [
                                '@babel/preset-env',
                                {
                                    targets: {
                                        chrome: "67",
                                    },
                                    useBuiltIns: 'usage',
                                    corejs: 3
                                }
                            ]
                        ],

                        
                    }
                },
            },
            {
                test:/\.vue$/,
                use:'vue-loader'
            },
            {
                test: /\.css$/,
                use: [
                    'vue-style-loader',
                    'css-loader'
                ]
            }
        ]
    },
    plugins:[
        new VueLoaderPlugin(),
        // new HtmlWebpackPlugin({
        //     template:'./src/index.html',
        //     inject: 'body',
        //     minify: {
        //         removeComments: false
        //     }
        // })
    ]
};